/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import pojo.PhanHePoJo;
import util.DataProvider;

/**
 *
 * @author Kanet
 */
public class PhanHeDao {
     public static ArrayList<PhanHePoJo> LayDanhSachPhanhe(){
        ArrayList<PhanHePoJo> danhSach= new ArrayList<PhanHePoJo>();
        String str ="SELECT * FROM thongtin";
        DataProvider dp=new DataProvider();
        dp.open();
        try {
            ResultSet rs = dp.executeQuery(str);
            danhSach=new ArrayList<PhanHePoJo>();
            PhanHePoJo tt=null;
            while (rs.next()) {
                tt=new PhanHePoJo();
                tt.setIdPhanhe(rs.getInt("idPhanHe"));
                tt.setTenPhanHe(rs.getString("tenPhanHe"));
                danhSach.add(tt);
            }
            dp.close();
        } catch (SQLException ex) {
          System.out.println(ex.getMessage());
        }
        return danhSach;
    }
}
    

